Repository navigation
fix(catalog-sync): resolve target from --config, not OPENCODE_CONFIG_PATH (#4588) - #4591
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 40 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ab2991c64d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const r = runCli( | ||
| ['--config', configPath, '--runtime-config', overlayPath, '--models-dev', modelsDev, '--source-dir', sourceDir, '--json'], | ||
| { OPENCODE_CONFIG_PATH: overlayPath }, | ||
| ); |
There was a problem hiding this comment.
Preserve the environment override in the CLI regression test
The runCli helper deletes clean.OPENCODE_CONFIG_PATH after merging the supplied environment overrides, so this test never launches the CLI with the overlay variable set. Consequently, it would still pass with the original buggy config-resolution expression in main, leaving the end-to-end regression unprotected despite the helper-level unit coverage. Remove inherited values before applying explicit overrides, or spawn the CLI directly here so the intended environment reaches the child process.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 0e4afc8 — you were right, thank you. runCli spread the caller's env and then unconditionally deleted OPENCODE_CONFIG_PATH, so the CLI test never actually launched with the variable set and would have passed against the buggy code.
runCli now scrubs the ambient variable only when the test does not pass it explicitly. Verified the regression bites, running the same fixtures (tracked default with commandcode/acme-1, source snapshot adding acme-2, overlay with openai/g-1) with OPENCODE_CONFIG_PATH=<overlay> set:
- pre-fix script (base 26ce876): exit 0, report
"config": ".../overlay.jsonc"— the bug - fixed script: exit 3, report
"config": ".../tracked.jsonc"— validated addition found
Full suite: node --test bin/provider-catalog-sync.test.mjs — 30/30 pass.
@codex review
There was a problem hiding this comment.
Codex Review: Didn't find any major issues. Hooray!
Reviewed commit: 0e4afc875f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…sets it explicitly (#4588)
Fixes #4588.
Since the #4544 split,
OPENCODE_CONFIG_PATHnames the runtime overlay and is exported into every user session — butprovider-catalog-syncresolved its target asOPENCODE_CONFIG_PATH || --config, so it diffed (and with--applywould have written into) the overlay instead of the tracked configured default, and the env var beat an explicit--configflag.resolveConfigPath: explicit--config→OPENCODE_CATALOG_SYNC_CONFIG→<repo>/.opencode/opencode.jsonc.OPENCODE_CONFIG_PATHis never consulted for the target (the overlay is still read via--runtime-configfor the merged effective config).bin/provider-catalog-sync.test.mjs: unit coverage of the full precedence (flag > catalog env > default,OPENCODE_CONFIG_PATHignored in every leg) plus an end-to-end CLI run withOPENCODE_CONFIG_PATHpointing at an overlay fixture, asserting the report targets the tracked file and finds the validated addition (exit 3).Tests:
node --test bin/provider-catalog-sync.test.mjs— 30/30 pass (28 existing + 2 new).Queue: task 6473 (triage task 6470 confirmed the defect at main 73c0ec7).
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.